<?php
/**
 * Project: AIGC
 * Author: moufer <moufer@163.com>
 * Date: 2024/8/24 01:40
 */

namespace module\user\model;

use mof\Model;

class SignIn extends Model
{
    protected $name = 'user_signin';

    protected $updateTime = false;

    public function searchUserIdAttr($query, $value, $data): void
    {
        $query->where('user_id', $value);
    }

    /**
     * 日历搜索器
     */
    public function searchCalendarAttr($query, $value, $data): void
    {
        //$value格式: 2024-08
        $query->where('day', 'between', [
            date('Y-m-01', strtotime($value)),
            date('Y-m-t', strtotime($value))
        ]);
    }
}